import java.util.Scanner;

public class Java006 {
    public static void main(String[] args) {
        int m,n,i;
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入两个正整数m,n");
        m=sc.nextInt();
        n=sc.nextInt();
        System.out.println(CommonFactor(m,n));//最大公因数
        System.out.println(CommonMultiples(m,n));//最小公倍数
    }
    public static int CommonFactor(int m,int n){
        int num;
        while(true){
            num=n%m;
            if(num==0){
                break;
            }else{
                n=m;
                m=num;
            }
        }
        return m;
    }

    public static int CommonMultiples(int m,int n){
        return m*n/CommonFactor(m,n);
    }
}
